<?php
namespace Admin\Controller;
use Think\Controller;
class GroupController extends CommonController {
    public function lists(){


        // 查询规则(rule)表的数据
        $rule = $this->Model->select();
        $this->assign('rule',$rule);
        $this->display();

    }

    /**
     * 角色添加
     *
     * @return void
     * @author
     **/
    function add()
    {
        if(IS_POST){
            print_r(I('post.'));die;
            $_POST['rules'] = implode(',',$_POST['rules']);
            $id = $this->Model->add(I('post.'));
            if($id){
                $this->success('角色添加成功',U('Admin/group/lists'),1);die;
            }else{
                $this->error('角色添加失败','',1);die;
            }
        }

        $rule = D('rule')->select();

        $this->assign('rule',$rule);
        $this->display();
    }
}